<template>
  <div>
    <!-- 卸车 2018/7/17 zhangQ -->
    <navbar>
    </navbar>
    <mu-container style="background-color: #fff;padding: 20px;">
      <mu-row>
        <mu-col>
          错误描述
        </mu-col>
      </mu-row>
      <mu-row>
        <mu-col>
          <mu-text-field v-model="form.errorMsg" :rows="5" multi-line full-width></mu-text-field>
        </mu-col>
      </mu-row>
      <!--图片提交-->
      <!--<mu-row>
        <mu-col>
          <mu-paper class="demo-paper" :z-depth="1" style="width:80px;height: 80px;"></mu-paper>
        </mu-col>
      </mu-row>-->
    </mu-container>

    <mu-row style="margin-top: 10px;padding: 0 20px;">
      <mu-col>
        <mu-flex justify-content="center" align-items="center">
          <mu-button full-width color="primary" @click="submitError">提交</mu-button>
        </mu-flex>
      </mu-col>
    </mu-row>
  </div>
</template>

<script>
  import {errorSubmit} from '@/api/common/index'

  export default {
    name: 'index',
    data () {
      let form = {
        id: this.id,
        errorMsg: '',
        errorState: contant.unLoad.checked
      }
      let datas = {form}
      return datas
    },
    props: {
      id: ''
    },
    computed: {},
    methods: {
      /* updateImg() {
       api.actionSheet({
       title: '请选择方式',
       cancelTitle: '取消',
       buttons: ['拍照上传','相册上传']
       }, function(ret, err) {
       if (ret) {
       if (ret.buttonIndex === 1) {
       get_pic('camera')
       }else if (ret.buttonIndex === 2) {
       get_pic('library')
       }
       } else {
       this.$toast.error(err)
       }
       })
       } */
      submitError () {
        let param = {
          id: this.from.id,
          errorMsg: this.from.errorMsg,
          errorState: contant.unLoad.checked
        }
        if (this.form.errorMsg && this.id) {
          errorSubmit(param).then(res => {
            if (+res.data.isSuccess === 1) {
              this.$toast.success('提交成功')
              this.$router.go(-1)
            } else {
              this.$toast.error('出现错误！')
            }
          }).catch()
        } else {
          this.$toast.error('请填写错误描述后再提交！')
        }
      }
    },
    created () {
    },
    mounted () {
    }
  }
</script>
<style>
  .mu-text-field-multiline {
    border-top: 1px solid #ddd;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;

  }
</style>
